object frmSetOwner: TfrmSetOwner
  Left = 517
  Top = 328
  Width = 408
  Height = 451
  AutoSize = True
  Caption = #1089#1086#1073#1089#1090#1074#1077#1085#1085#1080#1082#1072
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  Position = poMainFormCenter
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Panel1: TPanel
    Left = 0
    Top = 0
    Width = 400
    Height = 424
    AutoSize = True
    BevelOuter = bvNone
    TabOrder = 0
    object gbClient: TGroupBox
      Left = 0
      Top = 161
      Width = 400
      Height = 43
      Align = alTop
      Caption = ' '#1043#1088#1072#1078#1076#1072#1085#1080#1085' '
      TabOrder = 2
      DesignSize = (
        400
        43)
      object lcbClients: TDBLookupComboboxEh
        Left = 32
        Top = 16
        Width = 355
        Height = 19
        AlwaysShowBorder = True
        Anchors = [akLeft, akTop, akRight]
        DataField = 'CLIENT_ID'
        DataSource = dsc_Owner
        EditButtons = <
          item
            Style = ebsEllipsisEh
            OnClick = DBLookupComboboxEh2EditButtons0Click
          end>
        Flat = True
        KeyField = 'ID'
        ListField = 'NAME'
        ListSource = dsc_Client
        TabOrder = 0
        Visible = True
      end
    end
    object gbAbonent: TGroupBox
      Left = 0
      Top = 118
      Width = 400
      Height = 43
      Align = alTop
      Caption = ' '#1054#1073#1098#1077#1082#1090' '#1089#1086#1073#1089#1090#1074#1077#1085#1085#1086#1089#1090#1080' '
      TabOrder = 1
      DesignSize = (
        400
        43)
      object lcbAbonent: TDBLookupComboboxEh
        Left = 32
        Top = 16
        Width = 355
        Height = 19
        AlwaysShowBorder = True
        Anchors = [akLeft, akTop, akRight]
        DataField = 'ABONENT_ID'
        DataSource = dsc_Owner
        EditButtons = <>
        Flat = True
        KeyField = 'ID'
        ListField = 'ADDRESS'
        ListSource = dsc_Abonent
        TabOrder = 0
        Visible = True
      end
    end
    object GroupBox3: TGroupBox
      Left = 0
      Top = 204
      Width = 400
      Height = 187
      Align = alTop
      TabOrder = 3
      object Label1: TLabel
        Left = 58
        Top = 14
        Width = 106
        Height = 13
        Alignment = taRightJustify
        Caption = #1044#1086#1083#1103' '#1089#1086#1073#1089#1090#1074#1077#1085#1085#1086#1089#1090#1080
      end
      object Label2: TLabel
        Left = 34
        Top = 38
        Width = 130
        Height = 13
        Alignment = taRightJustify
        Caption = #1044#1086#1082#1091#1084#1077#1085#1090' '#1089#1086#1073#1089#1090#1074#1077#1085#1085#1086#1089#1090#1080
      end
      object Label3: TLabel
        Left = 9
        Top = 62
        Width = 155
        Height = 13
        Alignment = taRightJustify
        Caption = #1058#1080#1087' '#1076#1086#1082#1091#1084#1077#1085#1090#1072' '#1089#1086#1073#1089#1090#1074#1077#1085#1085#1086#1089#1090#1080
      end
      object Label4: TLabel
        Left = 24
        Top = 86
        Width = 140
        Height = 13
        Alignment = taRightJustify
        Caption = #1054#1088#1075#1072#1085', '#1074#1099#1076#1072#1074#1096#1080#1081' '#1076#1086#1082#1091#1084#1077#1085#1090
      end
      object Label5: TLabel
        Left = 67
        Top = 110
        Width = 97
        Height = 13
        Alignment = taRightJustify
        Caption = #1055#1077#1088#1080#1086#1076' '#1076#1077#1081#1089#1090#1074#1080#1103' '#1089
      end
      object Label6: TLabel
        Left = 98
        Top = 134
        Width = 66
        Height = 13
        Alignment = taRightJustify
        Caption = #1044#1072#1090#1072' '#1074#1099#1076#1072#1095#1080
      end
      object Label7: TLabel
        Left = 101
        Top = 158
        Width = 63
        Height = 13
        Alignment = taRightJustify
        Caption = #1055#1088#1080#1084#1077#1095#1072#1085#1080#1077
      end
      object Label8: TLabel
        Left = 280
        Top = 110
        Width = 12
        Height = 13
        Alignment = taRightJustify
        Caption = #1087#1086
      end
      object deDesc: TDBEditEh
        Left = 172
        Top = 156
        Width = 213
        Height = 19
        AlwaysShowBorder = True
        DataField = 'DESCRIPTION'
        DataSource = dsc_Owner
        EditButtons = <>
        Flat = True
        TabOrder = 7
        Visible = True
      end
      object dbdeBDate: TDBDateTimeEditEh
        Left = 172
        Top = 108
        Width = 85
        Height = 19
        AlwaysShowBorder = True
        DataField = 'BDATE'
        DataSource = dsc_Owner
        EditButtons = <>
        Flat = True
        Kind = dtkDateEh
        TabOrder = 4
        Visible = True
      end
      object dbdeEDate: TDBDateTimeEditEh
        Left = 300
        Top = 108
        Width = 85
        Height = 19
        AlwaysShowBorder = True
        DataField = 'EDATE'
        DataSource = dsc_Owner
        EditButtons = <>
        Flat = True
        Kind = dtkDateEh
        TabOrder = 5
        Visible = True
      end
      object dbdeDocDate: TDBDateTimeEditEh
        Left = 172
        Top = 132
        Width = 85
        Height = 19
        AlwaysShowBorder = True
        DataField = 'DOCDATE'
        DataSource = dsc_Owner
        EditButtons = <>
        Flat = True
        Kind = dtkDateEh
        TabOrder = 6
        Visible = True
      end
      object lcbDocType: TDBLookupComboboxEh
        Left = 172
        Top = 60
        Width = 213
        Height = 19
        AlwaysShowBorder = True
        DataField = 'DOC_TYPE'
        DataSource = dsc_Owner
        EditButtons = <
          item
            Style = ebsEllipsisEh
          end>
        Flat = True
        KeyField = 'ID'
        ListField = 'NAME'
        ListSource = dsc_DocTypes
        TabOrder = 2
        Visible = True
      end
      object deDocNo: TDBEditEh
        Left = 172
        Top = 36
        Width = 213
        Height = 19
        AlwaysShowBorder = True
        DataField = 'DOC_NO'
        DataSource = dsc_Owner
        EditButtons = <>
        Flat = True
        TabOrder = 1
        Visible = True
      end
      object lcbDocOrgan: TDBLookupComboboxEh
        Left = 172
        Top = 84
        Width = 213
        Height = 19
        AlwaysShowBorder = True
        DataField = 'DOC_ORGAN'
        DataSource = dsc_Owner
        EditButtons = <
          item
            Style = ebsEllipsisEh
          end>
        Flat = True
        KeyField = 'ID'
        ListField = 'NAME'
        ListSource = dsc_DocOrgan
        TabOrder = 3
        Visible = True
      end
      object dbePercent: TDBEditEh
        Left = 172
        Top = 12
        Width = 213
        Height = 19
        AlwaysShowBorder = True
        DataField = 'OPERCENT'
        DataSource = dsc_Owner
        EditButtons = <>
        Flat = True
        TabOrder = 0
        Visible = True
      end
    end
    object pAddress: TPanel
      Left = 0
      Top = 0
      Width = 400
      Height = 118
      Align = alTop
      BevelOuter = bvNone
      TabOrder = 0
      inline fraAddressOwn: TfraAddress
        Left = 0
        Top = 0
        Width = 400
        Height = 118
        Align = alClient
        TabOrder = 0
        inherited SearchBox: TGroupBox
          Width = 400
          Height = 118
          Caption = ' '#1054#1073#1098#1077#1082#1090' '#1089#1086#1073#1089#1090#1074#1077#1085#1085#1086#1089#1090#1080' '
          Constraints.MinHeight = 0
          inherited SubPanel: TPanel
            Width = 396
            Height = 101
            inherited Label6: TLabel
              Left = 22
              Top = -147
            end
            inherited Label5: TLabel
              Left = 64
              Top = -27
            end
            inherited Label4: TLabel
              Left = 33
              Top = 76
            end
            inherited Label3: TLabel
              Left = 58
              Top = 52
            end
            inherited Label2: TLabel
              Left = 49
              Top = 28
            end
            inherited Label1: TLabel
              Left = 30
              Top = 4
            end
            inherited TownBox: TDBLookupComboboxEh
              Left = 86
              Top = 4
            end
            inherited StreetBox: TDBLookupComboboxEh
              Left = 86
              Top = 28
            end
            inherited NLSEdit: TDBEditEh
              Left = 96
              Top = -150
            end
            inherited NameEdit: TDBEditEh
              Left = 96
              Top = -27
            end
            inherited HouseBox: TDBLookupComboboxEh
              Left = 86
              Top = 52
            end
            inherited FindBtn: TButton
              Left = 4
              Top = -35
            end
            inherited ClearBtn: TButton
              Left = 84
              Top = -35
            end
            inherited AppartBox: TDBLookupComboboxEh
              Left = 86
              Top = 76
              DataField = 'ABONENT_ID'
              DataSource = dsc_Owner
            end
            inherited AddBtn: TButton
              Left = 164
              Top = -35
            end
          end
        end
        inherited QStreets: TpFIBDataSet
          Transaction = LocalTrans
          Database = MAINDM.pMainDatabase
          UpdateTransaction = LocalTrans
        end
        inherited QHouses: TpFIBDataSet
          Transaction = LocalTrans
          Database = MAINDM.pMainDatabase
          UpdateTransaction = LocalTrans
        end
        inherited QTowns: TpFIBDataSet
          Transaction = LocalTrans
          Database = MAINDM.pMainDatabase
          UpdateTransaction = LocalTrans
        end
        inherited QApparts: TpFIBDataSet
          Transaction = LocalTrans
          UpdateTransaction = LocalTrans
        end
      end
    end
    object pButtons: TPanel
      Left = 0
      Top = 391
      Width = 400
      Height = 33
      Align = alTop
      BevelOuter = bvNone
      TabOrder = 4
      DesignSize = (
        400
        33)
      object bExit: TButton
        Left = 280
        Top = 4
        Width = 120
        Height = 25
        Anchors = [akRight, akBottom]
        Caption = #1042#1099#1093#1086#1076
        ModalResult = 2
        TabOrder = 1
        OnClick = bExitClick
      end
      object bSave: TButton
        Left = 156
        Top = 4
        Width = 120
        Height = 25
        Anchors = [akRight, akBottom]
        Caption = #1057#1086#1093#1088#1072#1085#1080#1090#1100
        TabOrder = 0
        OnClick = bSaveClick
      end
    end
  end
  object LocalTrans: TpFIBTransaction
    DefaultDatabase = MAINDM.pMainDatabase
    TimeoutAction = TARollback
    Left = 256
    Top = 16
  end
  object ds_Client: TpFIBDataSet
    SelectSQL.Strings = (
      'select p.client_id as id, (select c.name from clients c '
      '          where c.id = p.client_id) as name'
      
        '  from p_sel_abontenants_by_period(:pabonent_id, current_date, c' +
        'urrent_date) p'
      '  where status > 0'
      'union'
      'select a.client_id as id, (select c.name from clients c '
      '          where c.id = a.client_id) as name'
      '  from abonents a'
      '  where a.id = :pabonent_id'
      'union'
      'select c.id, c.name '
      '  from clients c'
      '  where c.id = :pclient_id'
      'order by 2')
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    Left = 62
    Top = 176
    oFetchAll = True
    object ds_ClientID: TFIBIntegerField
      FieldName = 'ID'
    end
    object ds_ClientNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 120
      EmptyStrToNull = True
    end
  end
  object dsc_Client: TDataSource
    DataSet = ds_Client
    Left = 98
    Top = 176
  end
  object ds_Owner: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE CLIENTS2ABONENT'
      'SET '
      '    CLIENT_ID = :CLIENT_ID,'
      '    ABONENT_ID = :ABONENT_ID,'
      '    OPERCENT = :OPERCENT,'
      '    DESCRIPTION = :DESCRIPTION,'
      '    BDATE = :BDATE,'
      '    EDATE = :EDATE,'
      '    DOC_TYPE = :DOC_TYPE,'
      '    DOC_NO = :DOC_NO,'
      '    DOCDATE = :DOCDATE,'
      '    DOC_ORGAN = :DOC_ORGAN'
      'WHERE'
      '    ID = :OLD_ID'
      '    ')
    DeleteSQL.Strings = (
      'DELETE FROM'
      '    CLIENTS2ABONENT'
      'WHERE'
      '        ID = :OLD_ID'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO CLIENTS2ABONENT('
      '    ID,'
      '    CLIENT_ID,'
      '    ABONENT_ID,'
      '    OPERCENT,'
      '    DESCRIPTION,'
      '    BDATE,'
      '    EDATE,'
      '    DOC_TYPE,'
      '    DOC_NO,'
      '    DOCDATE,'
      '    DOC_ORGAN'
      ')'
      'VALUES('
      '    :ID,'
      '    :CLIENT_ID,'
      '    :ABONENT_ID,'
      '    :OPERCENT,'
      '    :DESCRIPTION,'
      '    :BDATE,'
      '    :EDATE,'
      '    :DOC_TYPE,'
      '    :DOC_NO,'
      '    :DOCDATE,'
      '    :DOC_ORGAN'
      ')')
    RefreshSQL.Strings = (
      'SELECT'
      '    ID,'
      '    CLIENT_ID,'
      '    ABONENT_ID,'
      '    OPERCENT,'
      '    DESCRIPTION,'
      '    BDATE,'
      '    EDATE,'
      '    DOC_TYPE,'
      '    DOC_NO,'
      '    DOCDATE,'
      '    DOC_ORGAN'
      'FROM'
      '    CLIENTS2ABONENT '
      'where(  id = :powner_id'
      '     ) and (     CLIENTS2ABONENT.ID = :OLD_ID'
      '     )'
      '    ')
    SelectSQL.Strings = (
      'select'
      '    c2a.id,'
      '    c2a.client_id,'
      '    c2a.abonent_id,'
      '    c2a.opercent,'
      '    c2a.description,'
      '    c2a.bdate,'
      '    c2a.edate,'
      '    c2a.doc_type,'
      '    c2a.doc_no,'
      '    c2a.docdate,'
      '    c2a.doc_organ,'
      '    (select v.address from v_abons v'
      '       where v.id = c2a.abonent_id) as address'
      'from'
      '    clients2abonent c2a'
      'where c2a.id = :powner_id')
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    Left = 230
    Top = 172
    oFetchAll = True
    object ds_OwnerID: TFIBIntegerField
      FieldName = 'ID'
    end
    object ds_OwnerCLIENT_ID: TFIBIntegerField
      FieldName = 'CLIENT_ID'
    end
    object ds_OwnerABONENT_ID: TFIBIntegerField
      FieldName = 'ABONENT_ID'
    end
    object ds_OwnerOPERCENT: TFIBStringField
      FieldName = 'OPERCENT'
      Size = 16
      EmptyStrToNull = True
    end
    object ds_OwnerDESCRIPTION: TFIBStringField
      FieldName = 'DESCRIPTION'
      Size = 60
      EmptyStrToNull = True
    end
    object ds_OwnerBDATE: TFIBDateField
      FieldName = 'BDATE'
    end
    object ds_OwnerEDATE: TFIBDateField
      FieldName = 'EDATE'
    end
    object ds_OwnerDOC_TYPE: TFIBIntegerField
      FieldName = 'DOC_TYPE'
    end
    object ds_OwnerDOC_NO: TFIBStringField
      FieldName = 'DOC_NO'
      Size = 60
      EmptyStrToNull = True
    end
    object ds_OwnerDOCDATE: TFIBDateField
      FieldName = 'DOCDATE'
    end
    object ds_OwnerDOC_ORGAN: TFIBIntegerField
      FieldName = 'DOC_ORGAN'
    end
    object ds_OwnerADDRESS: TFIBStringField
      FieldName = 'ADDRESS'
      Size = 245
      EmptyStrToNull = True
    end
  end
  object dsc_Owner: TDataSource
    DataSet = ds_Owner
    Left = 262
    Top = 172
  end
  object ds_DocTypes: TpFIBDataSet
    SelectSQL.Strings = (
      'SELECT'
      '    ID,'
      '    NAME'
      'FROM'
      '    PAS_ROWN_DOCTYPE '
      'order by 2')
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    Left = 298
    Top = 256
    oFetchAll = True
    object ds_DocTypesID: TFIBIntegerField
      FieldName = 'ID'
    end
    object ds_DocTypesNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 60
      EmptyStrToNull = True
    end
  end
  object dsc_DocTypes: TDataSource
    DataSet = ds_DocTypes
    Left = 334
    Top = 256
  end
  object ds_DocOrgan: TpFIBDataSet
    SelectSQL.Strings = (
      'SELECT'
      '    ID,'
      '    NAME'
      'FROM'
      '    PAS_ROWN_DOCORGAN '
      'order by 2')
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    Left = 298
    Top = 292
    oFetchAll = True
    object ds_DocOrganID: TFIBIntegerField
      FieldName = 'ID'
    end
    object ds_DocOrganNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 30
      EmptyStrToNull = True
    end
  end
  object dsc_DocOrgan: TDataSource
    DataSet = ds_DocOrgan
    Left = 334
    Top = 292
  end
  object ds_Abonent: TpFIBDataSet
    SelectSQL.Strings = (
      'select v.id, v.address from v_abons v'
      'where v.id = :pabonent_id')
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    Left = 270
    Top = 128
    oFetchAll = True
    object ds_AbonentID: TFIBIntegerField
      FieldName = 'ID'
    end
    object ds_AbonentADDRESS: TFIBStringField
      FieldName = 'ADDRESS'
      Size = 245
      EmptyStrToNull = True
    end
  end
  object dsc_Abonent: TDataSource
    DataSet = ds_Abonent
    Left = 306
    Top = 128
  end
end
